<?php

namespace app\load\model\oa;

use think\Model;

/**
 * 审批记录表
 */
class FlowRecordModel extends Model
{
    protected $name = 'flow_record';

    //自动转换时间
    protected $dateFormat = 'Y-m-d H:i';

    protected $hidden = ['delete_time'];

    /**
     * 列表
     * @param array $where
     * @param string $filed
     * @return array
     */
    public function list(array $where = [], string $filed = '*'): array
    {
        return $this->db()->field($filed)
            ->alias('f')
            ->join('Admin a', 'a.id = f.check_user_id', 'left')
            ->where($where)
            ->filter(function ($vle) {
                $vle['check_time']  = date('Y-m-d H:i:s' , $vle['check_time']);
                $vle['thumb']  =  env('url') . $vle['thumb'];
                if ($vle['image']){
                    $vle['image']  =  env('url') . $vle['image'];
                }
            })->select()
            ->toArray();
    }
}